package com.bilgeadam.bean;

import java.io.Serializable;

import com.bilgeadam.customtags.TableSupport;

/**
 *
 * @author Bora SAYINER
 * @since Jan 18, 2015 5:32:46 PM
 * @version 1.0
 */
public class Movie implements Serializable, TableSupport {

	private String name;
	private int duration;

	public Movie() {
		this(null, 0);
	}

	public Movie(String name, int duration) {
		this.name = name;
		this.duration = duration;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getDuration() {
		return duration;
	}

	public void setDuration(int duration) {
		this.duration = duration;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((name == null) ? 0 : name.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj) return true;
		if (obj == null) return false;
		if (getClass() != obj.getClass()) return false;
		Movie other = (Movie) obj;
		if (name == null) {
			if (other.name != null) return false;
		} else if (!name.equals(other.name)) return false;
		return true;
	}

	@Override
	public String toString() {
		return "Movie [name=" + name + ", duration=" + duration + "]";
	}

	@Override
	public String[] getColumnNames() {
		return new String[] { "Süresi", "Adı" };
	}

}
